package cn.iocoder.yudao.module.brokerage.merchant.controller.admin;

import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.business.basic.controller.SimpleDetailController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.brokerage.merchant.pojo.vo.AdminBrokerageMerchantRecordQueryDTO;
import cn.iocoder.yudao.module.brokerage.merchant.pojo.vo.AdminBrokerageMerchantRecordVO;
import cn.iocoder.yudao.module.brokerage.merchant.service.AdminBrokerageMerchantRecordService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 推广商家分佣记录")
@RestController
@RequestMapping("/brokerage/merchant/record")
@Validated
public class BrokerageMerchantRecordController implements SimpleDetailController<AdminBrokerageMerchantRecordVO>, PageController<AdminBrokerageMerchantRecordVO, AdminBrokerageMerchantRecordQueryDTO> {
    @Resource
    private AdminBrokerageMerchantRecordService adminBrokerageMerchantRecordService;

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @Override
    public CommonResult<AdminBrokerageMerchantRecordVO> getDetail(Long id) {
        return success(adminBrokerageMerchantRecordService.getDetail(id));
    }

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @Override
    public CommonResult<PageResult<AdminBrokerageMerchantRecordVO>> getPage(Integer pageNo, Integer pageSize, AdminBrokerageMerchantRecordQueryDTO param) {
        return success(adminBrokerageMerchantRecordService.getPage(pageNo, pageSize, param));
    }

}